import axios from "axios";

// http://222.202.179.12:9527
// http://itech.oicp.vip:47702
const BASEURL = "http://itech.oicp.vip:47702";

//1. 登录
export const login = (account, password) => {
  return axios.request({
    url: BASEURL + "/administrator/administratorUser/login",
    method: "get",
    params: {
      account,
      password
    }
  });
};

//2. 角色管理列表
export const getRolesList = params => {
  return axios.request({
    url: BASEURL + "/administrator/roleManagement/list",
    params,
    method: "get"
  });
};

//3. 新增角色
export const addNewRole = data => {
  return axios.request({
    url: BASEURL + "/administrator/roleManagement/save",
    data,
    method: "post"
  });
};

//4. 修改角色
export const modifyRole = data => {
  return axios.request({
    url: BASEURL + "/administrator/roleManagement/update",
    data,
    method: "post"
  });
};

//5. 删除角色
export const deleteRole = ids => {
  return axios.request({
    url: BASEURL + "/administrator/roleManagement/remove",
    params: {
      ids
    },
    method: "post"
  });
};

//6.获取管理员用户列表
export const getAdminUserList = params => {
  return axios.request({
    url: BASEURL + "/administrator/administratorUser/list",
    params,
    method: "get"
  });
};

//7.新增管理员用户
export const addAdminUser = data => {
  return axios.request({
    url: BASEURL + "/administrator/administratorUser/save",
    data,
    method: "post"
  });
};

//8.修改管理员用户信息
export const modifyAdminUser = data => {
  return axios.request({
    url: BASEURL + "/administrator/administratorUser/update",
    data,
    method: "post"
  });
};

//9.删除管理员用户
export const deleteAdminUser = ids => {
  return axios.request({
    url: BASEURL + "/administrator/administratorUser/remove",
    params: {ids},
    method: "post"
  });
};

//10. 重置管理员密码
export const resetAdminUserPwd = id => {
  return axios.request({
    url: BASEURL + "/administrator/administratorUser/resetPWD",
    params: {id},
    method: "post"
  });
};

//11.获取活动列表
export const getActivityList = params => {
  return axios.request({
    url: BASEURL + "/activity/activity/list",
    params,
    method: "get"
  });
};

//12.新增活动
export const addActivity = data => {
  return axios.request({
    url: BASEURL + "/activity/activity/save",
    data,
    method: "post"
  });
};

//13.修改活动信息
export const modifyActivity = data => {
  return axios.request({
    url: BASEURL + "/activity/activity/update",
    data,
    method: "post"
  });
};

//14.删除活动
export const deleteActivity = ids => {
  return axios.request({
    url: BASEURL + "/activity/activity/remove",
    params:{
      ids
    },
    method: "post"
  });
};

//15.获取按活动类别分类统计的各类活动数量
export const getActivityTypeCount = params => {
  return axios.request({
    url: BASEURL + "/activity/activity/countActivityType",
    params,
    method: "get"
  });
};

//16.获取活动类型列表
export const getActivityType = params => {
  return axios.request({
    url: BASEURL + "/activity/activityType/list",
    params,
    method: "get"
  });
};

//17.新增活动类型
export const addActivityType = data => {
  return axios.request({
    url: BASEURL + "/activity/activityType/save",
    data,
    method: "post"
  });
};

//18.修改活动类型
export const modifyActivityType = data => {
  return axios.request({
    url: BASEURL + "/activity/activityType/update",
    data,
    method: "post"
  });
};

//19.删除活动类型
export const deleteActivityType = ids => {
  return axios.request({
    url: BASEURL + "/activity/activityType/remove",
    params:{ids},
    method: "post"
  });
};

